package com.xizi.single;

public class Singleton5 {

    //静态内部类实现单例模式
    private static class LazyHolder {
        private static final Singleton5 INSTANCE = new Singleton5();
    }

    private Singleton5() {

    }

    public static final Singleton5 getInstance() {
        return LazyHolder.INSTANCE;
    }

    public static void main(String[] args) {
        Singleton5 singleton5 = Singleton5.getInstance();
        Singleton5 singleton6 = Singleton5.getInstance();
        System.out.println(singleton5 == singleton6);
    }
}
